package com.itjob.scott.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.itjob.scott.util.CookieUtil;


public class RemoveServlet extends HttpServlet {

	private static final long serialVersionUID = -704120295575668936L;
	
	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		Cookie cookie =CookieUtil.getCookie(request, "user");
		
		cookie.setMaxAge(0);
		
		response.addCookie(cookie);
		
		response.sendRedirect(request.getContextPath()+ "/welcome.jsp");
		
		
	}


}
